
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>提问_骡爸爸问答</title>
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui,viewport-fit=cover" />
    <meta name="copyright" content="Copyright (c) 2006-2018 Luowowo." />
    <meta name="format-detection" content="telephone=no,address=no" />
    <meta name="referrer" content="always" />
    <meta name="apple-mobile-web-app-capable" content="no" />
    <meta name="apple-mobile-web-app-status-bar-style" content="no" />
    <link href="/css/quiz/mobile+css+head_mobile+css+ui%255EYVw%255E1550829726.css" rel="stylesheet" type="text/css"/>
    <link href="/css/quiz/ask.css" rel="stylesheet" type="text/css"/>
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/plugins/jrender/jrender.min.js"></script>
    <script src="/js/plugins/form/jquery.form.js"></script>
    <script src="/js/bootstrap-4.1.1-dist/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
    <script src="/js/plugins/dialog2/dialog.min.js"></script>
    <script src="/js/checkLogin.js"></script>
    <script src="/js/common.js"></script>
    <script>
        $(function () {

            //图片选择回显
            $("#changeBtn").click(function () {
                $("#file").click();
            });
            $("#file").change(function () {
                if ($(this).val()){//如果有值,说明修改了图片
                    $("#fileForm").ajaxSubmit(function (data) {
                        if (data.status == 1){
                            //将背景url回显过去
                            $("#coverUrl").attr("src",data.url);
                            $("#putCoverUrl").val(data.url);
                        }
                    });
                }
            });
            var json = JSON.parse(sessionStorage.getItem("user"));
            var currentUserId =json.id;
            if(json){
                $("._j_q_qid").val(currentUserId);
            }


            $(".quizBtn").click(function () {
                if ("" == $(".question").val() || $(".question").val() == null){
                    $(document).dialog({
                        type : 'notice',
                        content: '<span class="info-text">内容不能为空</span>',
                        autoClose: 1000,
                        position: 'bottom'
                    });
                }else if("" == $(".content").val() || $(".content").val() == null){
                    $(document).dialog({
                        type : 'notice',
                        content: '<span class="info-text">内容不能为空</span>',
                        autoClose: 1000,
                        position: 'bottom'
                    });
                }else if("" == $(".place").val() || $(".place").val() == null){
                    $(document).dialog({
                        type : 'notice',
                        content: '<span class="info-text">内容不能为空</span>',
                        autoClose: 1000,
                        position: 'bottom'
                    });
                }else{
                    $("#quizForm").ajaxSubmit(function (data) {
                        if (data){
                            window.location.href = "/question.html";
                        }
                    });
                }


            });
        });
    </script>
</head>
<body>
<div id="pos38"></div>
<header class="head2home">
    <div class="LBtn">
        <a class="btn back" href="javascript:history.go(-1);" id="_j_top_history_back">
            <span><i class="fa fa-chevron-left fa-2x"></i></span>
        </a>
    </div>
    <div class="rBtn">
        <a href="/" class="home">骡窝窝提问页面</a>
        <a href="/index.html" class="sch"></a>
    </div>
</header>

<section class="Addnew">
    <form id="quizForm" action="http://localhost:8088/questions" method="post">
        <div id="_j_publish_box" class="ask_tan_con">
            <dl>
                <dd class="_j_word">
                    <input name="questionTitle" class="_j_q_title _j_word_check question" placeholder="请输入你的问题，不少于10个字哦" >
                    <input value="0" name="questionerId"  type="hidden" class="_j_q_qid">
                    <div class="wordsnum">
                        <span class="_j_min_num" style="display:none;">10</span>
                    </div>
                    <div class="err-tips" style="display: none;"></div>
                </dd>
            </dl>
            <dl>
                <dt>问题说明（可选）</dt>
                <dd class="con_textarea _j_word" id="con_textarea">
                    <textarea rows=1 id="pnl_textarea" class="_j_q_content _j_word_check content" name="questionContent"></textarea>
                    <div class="wordsnum">
                        <span class="_j_word_num">0</span>/<span class="_j_max_num">1000</span>
                    </div>
                    <div class="err-tips" style="display: none;">
                    </div>
                </dd>
            </dl>
            <dl>
                <dt>选择目的地</dt>
                <dd>
                    <input name="questionPlace" class="_j_q_mddname place" placeholder="请输入目的地" >
                    <ul class=" _j_mdd_suggest" style="display:none;"></ul>
                    <i class="loc"></i>
                </dd>
            </dl>
            <dl>
                <dt>选择问题封面</dt>
                <dd>
                    <div class="cover">
                        <img id="coverUrl" width="100%" height="200px" />
                        <button type="button" class="btn" id="changeBtn">
                            <i class="fa fa-pencil-square-o"></i>
                            <small>上传问题封面</small>
                            <input type="hidden" name="questionCoverImgUrl" id="putCoverUrl">
                        </button>
                    </div>
                </dd>
            </dl>
            <dl>
                <dd>
                    <a class="_j_publish_question quizBtn" >发布问题</a>
                </dd>
            </dl>
        </div>
    </form>
    <form id="fileForm" action="http://localhost:8088/images" method="post" enctype="multipart/form-data">
        <input type="file" name="file" id="file" style="display: none">
    </form>
</section>
</body>
</html>
